/*
 * @lc app=leetcode.cn id=830 lang=javascript
 *
 * [830] 较大分组的位置
 */

// @lc code=start
/**
 * @param {string} s
 * @return {number[][]}
 */
var largeGroupPositions = function (s) {
  let start = 0;
  let result = [];
  for (let i = 1; i < s.length; i++) {
    if (s.charAt(i) !== s.charAt(start)) {
      if (i - start >= 3) {
        result.push([start, i - 1])
      }
      start = i;
    }
  }
  if (s.length - start >= 3) {
    result.push([start, s.length - 1])
  }
  return result;
};
// @lc code=end

